package com.micro.school.edu.controller;

import java.util.List;

import com.micro.school.common.core.utils.poi.ExcelUtil;
import com.micro.school.common.core.web.controller.BaseController;
import com.micro.school.common.core.web.domain.AjaxResult;
import com.micro.school.common.core.web.page.TableDataInfo;
import com.micro.school.common.log.annotation.Log;
import com.micro.school.common.log.enums.BusinessType;
import com.micro.school.common.security.annotation.RequiresPermissions;
import com.micro.school.edu.domain.vo.CollegeModelVo;
import com.micro.school.edu.service.ICollegeModelService;
import com.micro.school.system.api.domain.vo.CollegeModelVos;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 学院模式Controller
 *
 * @author rakic
 * @date 2025-08-07
 */
@RestController
@RequestMapping("/model")
public class CollegeModelController extends BaseController
{
    @Autowired
    private ICollegeModelService collegeModelService;

    /**
     * 查询学院模式列表
     */
    @GetMapping("/list")
    public TableDataInfo list(CollegeModelVo collegeModelVo)
    {
        startPage();
        List<CollegeModelVo> list = collegeModelService.selectCollegeModelList(collegeModelVo);
        return getDataTable(list);
    }
    /**
     * 查询列表不分页
     */
    @PostMapping("/getCollegeModeLists")
    public  AjaxResult getCollegeModeLists(@RequestBody CollegeModelVos collegeModelVos)
    {
        List<CollegeModelVos> list = collegeModelService.selectCollegeModelLists(collegeModelVos);
        return success(list);
    }

    /**
     * 查询列表不分页
     */
    @PostMapping("/getCollegeModeLists1")
    public  AjaxResult getCollegeModeLists1(@RequestBody CollegeModelVos collegeModelVos)
    {
        List<CollegeModelVos> list = collegeModelService.selectCollegeModelLists1(collegeModelVos);
        return success(list);
    }


    /**
     * 查询列表不分页
     */
    @GetMapping("/getCollegeModeList")
    public  AjaxResult getCollegeModeList(CollegeModelVo collegeModelVo)
    {
        List<CollegeModelVo> list = collegeModelService.selectCollegeModelList(collegeModelVo);
        return success(list);
    }


    /**
     * 导出学院模式列表
     */
    @Log(title = "学院模式", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CollegeModelVo collegeModelVo)
    {
        List<CollegeModelVo> list = collegeModelService.selectCollegeModelList(collegeModelVo);
        ExcelUtil<CollegeModelVo> util = new ExcelUtil<CollegeModelVo>(CollegeModelVo.class);
        util.exportExcel(response, list, "学院模式数据");
    }

    /**
     * 获取学院模式详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(collegeModelService.selectCollegeModelById(id));
    }

    /**
     * 获取学院模式详细信息
     */
    @GetMapping(value = "/feign/{id}")
    public AjaxResult getFeignInfo(@PathVariable("id") Long id)
    {
        return success(collegeModelService.selectCollegeModelByIds(id));
    }

    /**
     * 新增学院模式
     */
    @Log(title = "学院模式", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CollegeModelVo collegeModelVo)
    {
        return toAjax(collegeModelService.insertCollegeModel(collegeModelVo));
    }

    /**
     * 修改学院模式
     */
    @Log(title = "学院模式", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CollegeModelVo collegeModelVo)
    {
        return toAjax(collegeModelService.updateCollegeModel(collegeModelVo));
    }

    /**
     * 删除学院模式
     */
    @Log(title = "学院模式", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable List<Long> ids)
    {
        CollegeModelVo collegeModelVo=new CollegeModelVo();
        collegeModelVo=collegeModelService.selectCollegeModelById(ids.get(0));
        collegeModelVo.setDeleteFlag("1");
        return toAjax(collegeModelService.updateCollegeModel(collegeModelVo));
    }
//    @RequiresPermissions("@ss.hasPermi('system:model:remove')")
//    @Log(title = "学院模式", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    public AjaxResult remove(@PathVariable List<Long> ids)
//    {
//        return toAjax(collegeModelService.deleteCollegeModelByIds(ids));
//    }


}
